From a7c31ee80ea7065ba400149a2731d5154947483d Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 13 Dec 2006 11:29:09 +0000 Subject: [PATCH] [XEN] Kexec: Disable crash keyhandler when no crash kernel is loaded. Also make the crash dump key capital-C rather than lowercase to make it harder to hit by mistake. Signed-off-by: Ian Campbell --- xen/common/kexec.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/xen/common/kexec.c b/xen/common/kexec.c index 885afae80c..5906687a02 100644 --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -140,13 +140,21 @@ void machine_crash_kexec(void) static void do_crashdump_trigger(unsigned char key) { - printk("triggering crashdump\n"); - machine_crash_kexec(); + int pos = (test_bit(KEXEC_FLAG_CRASH_POS, &kexec_flags) != 0); + if ( test_bit(KEXEC_IMAGE_CRASH_BASE + pos, &kexec_flags) ) + { + printk("'%c' pressed -> triggering crashdump\n", key); + machine_crash_kexec(); + } + else + { + printk("'%c' pressed -> no crash kernel loaded -- not triggering crashdump\n", key); + } } static __init int register_crashdump_trigger(void) { - register_keyhandler('c', do_crashdump_trigger, "trigger a crashdump"); + register_keyhandler('C', do_crashdump_trigger, "trigger a crashdump"); return 0; } __initcall(register_crashdump_trigger); -- 2.30.2